﻿using MediatR;
using Traceability.Commont.Domains.ScratchTheFat;
using Traceability.Commont.DTOs.CommontFiles;
using Traceability.Commont.Infrastructures.Interfaces;

namespace U.Enterprise.Api.Applications.PartitionWarehousings
{
    public class SplitRUBackHandler : IRequestHandler<SplitRUBackCommond, Resqults>
    {

        private readonly IBateRepository<SplitRU> _SplitRU;

        public SplitRUBackHandler(IBateRepository<SplitRU> splitRU)
        {
            _SplitRU = splitRU;
        }

        public async Task<Resqults> Handle(SplitRUBackCommond request, CancellationToken cancellationToken)
        {
            var list = new Resqults() { Code=0};

            list.Date = _SplitRU.GetAll().FirstOrDefault(x => x.SplitWarehousingId == request.SplitWarehousingId);


            return list;


        }
    }
}
